<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="../../Templates/SubFolderTemplate.xhtml"
                xmlns:p="http://primefaces.prime.com.tr/ui"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core">
    <ui:define name="head-title">
        <title>Add New Customer | Merlion's ERP System</title>
    </ui:define>
    
    
    <ui:define name="content">
        <f:view beforePhase="#{viewCustomerInvoicesManagerBean.initView}">
        <h:form>
            <p:panel id="panel" header="View Supplier's Invoices"> 
                <p:ajaxStatus style="width:16px;height:16px;">   
                    <f:facet name="start">   
                        <p:graphicImage value="http://www.primefaces.org:8080/showcase/design/ajaxloading.gif" /> 
                    </f:facet> 
 
                    <f:facet name="complete">   
                        <h:outputText value="" />   
                    </f:facet>   
                </p:ajaxStatus> 
 
                <p:messages /> 
 
                
                    
                    
                    <h:outputLabel for="supplierName" style="font-weight: bold" value="Search Company: " /> 
                    <p:autoComplete value="#{viewSupplierInvoicesManagerBean.supplierName}" required="true"
                                    id="supplierName" label="supplierName" requiredMessage="Company Name is required." completeMethod="#{viewSupplierInvoicesManagerBean.complete}">
                    </p:autoComplete>
                        <p:message for="supplierName" />                         
                        
                
                <p:commandButton value="Retrieve Information" update="panel" actionListener="#{viewSupplierInvoicesManagerBean.retrieve}" ajax="true"/>
                
                <p:fieldset legend="List of Invoices Information" rendered="#{viewSupplierInvoicesManagerBean.isExisting}">    
                       <p:dataTable var="supplierInvoice" value="#{viewSupplierInvoicesManagerBean.selectedSupplier.supplierInvoices}"
                                     emptyMessage="No Supplier Invoices" style="width: 50%;" >
                            
                           <p:column sortBy="#{supplierInvoice.supplierInvoiceId}">
                        <f:facet name="header">
                            <h:outputText value="Supplier Invoice ID"/>
                        </f:facet>
                               <h:outputText value="#{supplierInvoice.supplierInvoiceId}"/>
                    </p:column>

                    <p:column>
                        <f:facet name="header">
                            <h:outputText value="Date"/>
                        </f:facet>
                        <h:outputText value="#{supplierInvoice.supplierInvoiceDate}" style="width: 150px"/>
                    </p:column>
                    
                     <p:column>
                        <f:facet name="header">
                            <h:outputText value="Amount"/>
                        </f:facet>
                         <h:outputText value="#{supplierInvoice.supplierInvoiceAmount}" style="width: 150px"/>
                    </p:column>
                    
                     <p:column>
                        <f:facet name="header">
                            <h:outputText value="Material Order ID"/>
                        </f:facet>
                         <h:outputText value="#{supplierInvoice.materialOrder.materialOrderId}" style="width: 150px"/>
                    </p:column>
                    
                    <p:column>
                        <f:facet name="header">
                            <h:outputText value="Status"/>
                        </f:facet>
                        <h:outputText value="#{supplierInvoice.stateSupplierInvoice}" style="width: 150px"/>
                    </p:column>
                        </p:dataTable>
        </p:fieldset>
                
                
                </p:panel> 
        </h:form>
        </f:view>
        
    </ui:define>

</ui:composition>
